package com.mall.service.eshop;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mall.client.eshop.EshopTradeService;
import com.mall.custom.dao.read.EshopTradeReadMapper;
import com.mall.custom.dao.write.EshopTradeWriteMapper;
import com.mall.pojo.EshopTrade;
import com.mall.pojo.EshopTradeExample;

@Service
public class EshopTradeServiceImpl implements EshopTradeService {
	
	@Autowired
	private EshopTradeReadMapper eshopTradeReadMapper;
	@Autowired
	private EshopTradeWriteMapper eshopTradeWriteMapper;
	
	/**
	 * 查找订单
	 * @param id
	 * @return
	 */
	@Override
	public EshopTrade getEshopTradeByEshopTradeId(Long id) {
		// TODO Auto-generated method stub
		return this.eshopTradeReadMapper.selectByPrimaryKey(id);
	}
	/**
	 * 查找订单集合
	 * @param eshopTradeExample
	 * @return
	 */
	@Override
	public List<EshopTrade> getEshopTradeListByEshopTradeExample(EshopTradeExample eshopTradeExample) {
		// TODO Auto-generated method stub
		return this.eshopTradeReadMapper.selectByExample(eshopTradeExample);
	}

	/**
	 * 添加订单
	 * @param eshopTrade
	 * @return
	 */
	@Override
	public int insertEshopTradeByEshopTrade(EshopTrade eshopTrade) {
		// TODO Auto-generated method stub
		return this.eshopTradeWriteMapper.insert(eshopTrade);
	}

	/**
	 * 修改订单
	 * @param eshopTrade
	 * @return
	 */
	@Override
	public int modifyEshopTradeByEshopTrade(EshopTrade eshopTrade) {
		// TODO Auto-generated method stub
		return this.eshopTradeWriteMapper.updateByPrimaryKey(eshopTrade);
	}

	/**
	 * 删除订单
	 * @param id
	 * @return
	 */
	@Override
	public int deleteEshopTradeByEshopTradeId(Long id) {
		// TODO Auto-generated method stub
		return this.eshopTradeWriteMapper.deleteByPrimaryKey(id);
	}

}
